package structure;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by steve (flyketch@gmail.com)
 * 2019-03-23 13:42
 */
public class FindLists {
    public static void main(String[] args) {
        List<Integer> one = Arrays.asList(1, 2, 9, 4, 5, 6, 7, 8);
        List<Integer> two = Arrays.asList(3, 4, 5);
        List<Integer> res = findLists(one, two);
        System.out.println(res);
    }

    public static List<Integer> findLists(List<Integer> L, List<Integer> P) {

        List<Integer> result = new ArrayList<>();

        for (int i=0; i<P.size(); i++) {
            Integer a = P.get(i)-1;
            Integer b = L.get(a);
            result.add(b);
        }
        return result;
    }

}
